import request from "../../utils/request.js"
import detailData from './detailDate.js'
export default {
	state: {
		cartList: [],
		cartId:detailData.state.cartId
	},
	actions: {
		//获取购物车数据
		async getcartList({
			commit
		}) {
			const result = await request('/getcartList')
			commit("CART_LIST", result)
		}

	},
	mutations: {
		CART_LIST(state, result) {
			state.cartList = result
		}
	},
	getters: {
		bannerUrlList(state){
			return state.cartList[0].cateList.bannerUrlList || []
		},
		fin(state){
			return detailData.state.newCart
		}
	},
}
